Skip to content

fix: make mutations correctly invalidate queries - #1216

Merged
ChibiBlasphem merged 1 commit into
mainfrom
fix/correctly-invalidate-queries-on-mutation
Nov 24, 2025
Merged

fix: make mutations correctly invalidate queries#1216
ChibiBlasphem merged 1 commit into
mainfrom
fix/correctly-invalidate-queries-on-mutation

Conversation

@ChibiBlasphem

@ChibiBlasphem ChibiBlasphem commented Nov 24, 2025

Copy link
Copy Markdown
Contributor

Simple PR to naively and manually invalidate queries to avoid stale data being kept in the app.

A further PR will add conventions on query caching strategy and a more streamlined way of invalidating related queries


Note

Standardizes React Query keys to cases and adds onSuccess invalidation to refresh cases data after mutations.

  • Queries/Cases (React Query):
    • Standardize query keys from ['case', ...] to ['cases', ...] across mutations and useCreateKycEnrichmentQuery.
    • Add useQueryClient and onSuccess handlers to invalidate ['cases'] after mutations in:
      • useAddCommentMutation, useAddRuleSnoozeMutation, useAddToCaseMutation, useCloseCaseMutation, useCreateCaseMutation, useEditAssigneeMutation, useEditInboxMutation, useEditNameMutation, useEditSuspicionMutation, useEditTagsMutation, useEscalateCaseMutation, useMassUpdateCasesMutation, useOpenCaseMutation, useSnoozeCaseMutation.

Written by Cursor Bugbot for commit 6c81eca. This will update automatically on new commits. Configure here.

@ChibiBlasphem
ChibiBlasphem requested a review from a team November 24, 2025 12:19

@Pascal-Delange Pascal-Delange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have specific questions on the code directly, just a sanity check perhaps: did you make sure that it does not reset filters and pagination state when we do a batch action in the inbox ?

@ChibiBlasphem

Copy link
Copy Markdown
Contributor Author

I don't have specific questions on the code directly, just a sanity check perhaps: did you make sure that it does not reset filters and pagination state when we do a batch action in the inbox ?

Filters and pagination states are parameters for a query. Query invalidations clear the cache stored for a query. So invalidating query cannot reset filters and pagination states, only the displayed results.

@Pascal-Delange Pascal-Delange left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool!

@ChibiBlasphem
ChibiBlasphem merged commit 5d70980 into main Nov 24, 2025
6 checks passed
@ChibiBlasphem
ChibiBlasphem deleted the fix/correctly-invalidate-queries-on-mutation branch November 24, 2025 15:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants